<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Feedback extends My_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('feedback_model', 'feedback');
        $this->load->model("user_model","user");
		
	}
	
	/**
	 * 添加意见反馈
	 */
	public function add()
	{
		$params['content'] = $this->queryData['content'];
		$validate = new Validate(['content' => 'require|string']);
        if (!$validate->check($params)) 
        {
            $this->errorCode = 50003;
            $this->errorMessage = $validate->getError();
            $this->createApi();
            exit;
        }
		$AccountID = $this->userDetail['AccountID'];
		$fromUsername = $this->userDetail['username'];

		$data = array(
			'content'=>$params['content'],
			'feedbackperson'=>$AccountID,
			'addtime'=>time(),
			'fromUsername'=>$fromUsername
			);
		$res = $this->feedback->addFeedback($data);	
		$this->createApi();
	}
}

/* End of file feedback.php */
/* Location: ./application/controllers/feedback.php */
